﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Text;
using System.Data.SqlClient;
using lakethaiClassLibrary;

public partial class home_product : BasePage
{
    protected string productList = string.Empty;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Title = Resources.header.productTitle;
        this.BindingData();
    }
    private void BindingData()
    {
        string lang = HttpContext.Current.Session["lancode"].ToString();
        this.lblTitle1.Text = lang.CompareTo("en") == 0 ? "All products" : "Tất cả";
        #region get-product-list
        SqlParameter[] param1 = { new SqlParameter("lang", lang) };
        DataTable dt = myDataBinding.GetData("_productGetListForShow", param1);
        if (dt == null || dt.Rows.Count <= 0) return;
        StringBuilder sb = new StringBuilder();
        foreach (DataRow row in dt.Rows)
        {
            sb.Append("<div class=\"line\"></div>");
            sb.Append("<div class=\"block\">");
            sb.Append("<img src=\"" + row[1].ToString()
                + "\" alt=\"\" title=\"" + row[2].ToString() + "\" />");
            sb.Append("<a href=\"../P" + row[0].ToString() + "/"
                + myHelp.createURLString(row[2].ToString()) + ".aspx\"");
            sb.Append("class=\"newsTitle\">" + row[2].ToString() + "</a>");
            sb.Append("<p>" + row[3].ToString() + "</p>");
            sb.Append("<a href=\"../P" + row[0].ToString() + "/"
                + myHelp.createURLString(row[2].ToString()) + ".aspx\"");
            sb.Append("class=\"newsDetail\">");
            if (lang.CompareTo("en") == 0)
                sb.Append("[Details]</a>");
            else
                sb.Append("[Chi tiết]</a>");
            sb.Append("</div>");//div block
        }
        this.productList = sb.ToString();
        #endregion
    }
}
